/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ksama.sshbasic.model.dao;

import com.ksama.sshbasic.model.entities.Message;
import java.util.List;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author said.najahi
 */
@Repository("employeDAO")
@Transactional
public class MessageDAO {

    private GenericDAO genericDAO;

    @Autowired
    public void setSessionFactory(SessionFactory sessionFactory) {
        genericDAO = new GenericDAO(Message.class, new HibernateTemplate(sessionFactory));
    }

    @Transactional(readOnly = false)
    public void delete(Message t) {
        genericDAO.delete(t);
    }

    public List<Message> getAll() {
        return genericDAO.getAll();
    }

    @Transactional(readOnly = false)
    public void save(Message t) {
        genericDAO.save(t);
    }

    public Message selectById(String id) {
        return (Message) genericDAO.selectById(id);
    }
}
